package com.dibang.app.operation.control.impl;

import android.support.annotation.NonNull;
import android.view.TextureView;
import android.view.View;
import android.widget.TextView;

import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.model.Marker;
import com.dibang.app.R;
import com.dibang.app.mvp.abs.AbsControl;
import com.dibang.app.mvp.abs.BeanFactory;
import com.dibang.app.mvp.util.DateUtils;
import com.dibang.app.operation.control.abs.GroupMessageControl;
import com.dibang.app.operation.model.abs.GroupMessageModel;
import com.dibang.app.operation.presenter.abs.GroupMessagePresenter;
import com.dibang.app.operation.provider.GroupMessageProImpl;
import com.dibang.app.operation.view.abs.GroupMessageView;
import com.dibang.app.operation.view.impl.MainViewImpl;
import com.dibang.app.view.GroupNumberHtmlHandler;
import com.dibang.app.view.ViewHelper;
import com.dx.dxloadingbutton.lib.LoadingButton;
import com.flyco.tablayout.utils.UnreadMsgUtils;
import com.flyco.tablayout.widget.MsgView;

import java.util.Date;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class GroupMessageControlImpl extends AbsControl<GroupMessageView, GroupMessagePresenter, GroupMessageModel, GroupMessageProImpl> implements GroupMessageControl {

    @BindView(R.id.group_message_map_view)
    TextureMapView mapView;

    @BindView(R.id.group_message_submit_up_car_view)
    LoadingButton submitView;

    @BindView(R.id.group_msg_num_view)
    MsgView msgNumView;

    @BindView(R.id.group_msg_chart_num_view)
    MsgView chartNumView;

    @BindView(R.id.group_message_start_time_text)
    TextView startTimeView;

    @BindView(R.id.group_message_current_num_text)
    TextView currentNumView;

    private Marker marker;

    public GroupMessageControlImpl(@NonNull View targetView) {
        super(targetView);
        ButterKnife.bind(this, targetView);
        ViewHelper.setLoadingButtonBackgroundShader(submitView);
        BeanFactory.getInstance(MainViewImpl.class).onMapViewExpand(mapView, marker);
        UnreadMsgUtils.show(msgNumView,5);
        UnreadMsgUtils.show(chartNumView,100);
        startTimeView.setText(DateUtils.getFuzzyFutureTimeDescriptionByNow(new Date().getTime()));
        GroupNumberHtmlHandler.setText(currentNumView,"3","5");
    }


    @OnClick(R.id.group_message_submit_up_car_view)
    public void onSubmitBoardingViewClick(View v){
        submitView.startLoading();
    }

}
